package com.jaws.demo.schedule.task;

import com.jaws.core.common.log.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


/**
 * 定时任务Demo
 * 使用SpringSchedule
 *
 * @author huxyc
 * @date 2018-08-21 10:30:12
 * @since v1.0.4
 */
@Component
@Slf4j
public class ClientDemoSchedule {


    /**
     * cron表达式方式启用定时任务
     */
    @Scheduled(cron = "0/10 * * * * ?")
    public void doScheduleFunByCron() {
        log.info(Log.op("DemoSchedule.doScheduleFunByCron").msg("-------------------------doScheduleFunByCron start---------------------").toString());
    }

    /**
     * 参数启用定时任务
     */
    @Scheduled(initialDelay = 3000L, fixedRate = 10000L)
    public void doScheduleFunByParam() {
        log.info(Log.op("DemoSchedule.doScheduleFunByParam").msg("-------------------------doScheduleFunByParam start---------------------").toString());
    }


}
